This notebook investigates the alexnet-based model with 8-augmentation with an extra convolutional layer with 192 output channels (as in the original paper by Krizhevsky et al).

When training the model, we saved both files from the best and most recent epoch. First plot the most recent file, to see the evolution of parameters.


In [1]:
import pylearn2.utils
import pylearn2.config
import theano
import neukrill_net.dense_dataset
import neukrill_net.utils
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import holoviews as hl
%load_ext holoviews.ipython
import sklearn.metrics


Using gpu device 0: Tesla K40c
:0: FutureWarning: IPython widgets are experimental and may change in the future.
Welcome to the HoloViews IPython extension! (http://ioam.github.io/holoviews/)
Available magics: %compositor, %opts, %params, %view, %%labels, %%opts, %%view
<matplotlib.figure.Figure at 0x7ffd505f5310>
<matplotlib.figure.Figure at 0x7ffd505f5cd0>
<matplotlib.figure.Figure at 0x7ffd505f5ad0>

In [57]:
m = pylearn2.utils.serial.load(
    "/disk/scratch/neuroglycerin/models/alexnet_based_extra_convlayer.pkl.recent")

In [58]:
channel = m.monitor.channels["valid_objective"]
hl.Curve(zip(channel.example_record,channel.val_record),label="valid_objective")


Out[58]:

In [59]:
plt.plot(channel.example_record,channel.val_record)


Out[59]:
[<matplotlib.lines.Line2D at 0x7ffd4d6cc6d0>]

In [60]:
def make_curves(model, *args):
    curves = None
    for c in args:
        channel = m.monitor.channels[c]
        c = c[0].upper() + c[1:]
        if not curves:
            curves = hl.Curve(zip(channel.example_record,channel.val_record),group=c)
        else:
            curves += hl.Curve(zip(channel.example_record,channel.val_record),group=c)
    return curves

In [61]:
make_curves(m,"valid_objective","valid_y_nll","train_y_nll")


Out[61]:

The graph keeps going down for the train_y_nll while it is sort of stable and slightly sloping upwards for valid_y_nll and valid_objective. We think it suggests that we are overfitting.

Let's now see the best parameter values.


In [49]:
m = pylearn2.utils.serial.load(
    "/disk/scratch/neuroglycerin/models/alexnet_based_extra_convlayer.pkl")

Holoviews appears to be letting me down below. The plot for Train_y_nll appears to show it going down to zero due to it cutting off the bottom of the y axis...


In [50]:
make_curves(m,"valid_y_nll","valid_objective","train_y_nll")


Out[50]:

In [63]:
4000000./(8*30000)


Out[63]:
16.666666666666668

In [64]:
7*16


Out[64]:
112

The scale of the graphs is 10^6 not 10^7, so supposedly this is the best value of valid_objective before we started overfitting.

Let's now see what score we get with the best parameter values from this model.


In [5]:
cd ..


/afs/inf.ed.ac.uk/user/s13/s1320903/Neuroglycerin/neukrill-net-work

In [6]:
%run check_test_score.py -v run_settings/alexnet_based_extra_convlayer.json


Loading settings..
Loading model...
Loading data...
Applying normalisation: global
Finding batch size...
    chosen batch size 3089 for 8 batches
Compiling forward prop...
Making predictions...
    Batch 1 of 8
    Batch 2 of 8
    Batch 3 of 8
    Batch 4 of 8
    Batch 5 of 8
    Batch 6 of 8
    Batch 7 of 8
    Batch 8 of 8
Collapsing predictions...
Log loss: 0.805021153139

Looks like a better score than the current best! Let's submit it to the leaderboard. Write a submisstion file:


In [8]:
!python test.py -v run_settings/alexnet_based_extra_convlayer.json


Using gpu device 1: Tesla K40c
Loading model...
Loading data...
Compiling Theano function...
Processing batch 1 of 256
Processing batch 2 of 256
Processing batch 3 of 256
Processing batch 4 of 256
Processing batch 5 of 256
Processing batch 6 of 256
Processing batch 7 of 256
Processing batch 8 of 256
Processing batch 9 of 256
Processing batch 10 of 256
Processing batch 11 of 256
Processing batch 12 of 256
Processing batch 13 of 256
Processing batch 14 of 256
Processing batch 15 of 256
Processing batch 16 of 256
Processing batch 17 of 256
Processing batch 18 of 256
Processing batch 19 of 256
Processing batch 20 of 256
Processing batch 21 of 256
Processing batch 22 of 256
Processing batch 23 of 256
Processing batch 24 of 256
Processing batch 25 of 256
Processing batch 26 of 256
Processing batch 27 of 256
Processing batch 28 of 256
Processing batch 29 of 256
Processing batch 30 of 256
Processing batch 31 of 256
Processing batch 32 of 256
Processing batch 33 of 256
Processing batch 34 of 256
Processing batch 35 of 256
Processing batch 36 of 256
Processing batch 37 of 256
Processing batch 38 of 256
Processing batch 39 of 256
Processing batch 40 of 256
Processing batch 41 of 256
Processing batch 42 of 256
Processing batch 43 of 256
Processing batch 44 of 256
Processing batch 45 of 256
Processing batch 46 of 256
Processing batch 47 of 256
Processing batch 48 of 256
Processing batch 49 of 256
Processing batch 50 of 256
Processing batch 51 of 256
Processing batch 52 of 256
Processing batch 53 of 256
Processing batch 54 of 256
Processing batch 55 of 256
Processing batch 56 of 256
Processing batch 57 of 256
Processing batch 58 of 256
Processing batch 59 of 256
Processing batch 60 of 256
Processing batch 61 of 256
Processing batch 62 of 256
Processing batch 63 of 256
Processing batch 64 of 256
Processing batch 65 of 256
Processing batch 66 of 256
Processing batch 67 of 256
Processing batch 68 of 256
Processing batch 69 of 256
Processing batch 70 of 256
Processing batch 71 of 256
Processing batch 72 of 256
Processing batch 73 of 256
Processing batch 74 of 256
Processing batch 75 of 256
Processing batch 76 of 256
Processing batch 77 of 256
Processing batch 78 of 256
Processing batch 79 of 256
Processing batch 80 of 256
Processing batch 81 of 256
Processing batch 82 of 256
Processing batch 83 of 256
Processing batch 84 of 256
Processing batch 85 of 256
Processing batch 86 of 256
Processing batch 87 of 256
Processing batch 88 of 256
Processing batch 89 of 256
Processing batch 90 of 256
Processing batch 91 of 256
Processing batch 92 of 256
Processing batch 93 of 256
Processing batch 94 of 256
Processing batch 95 of 256
Processing batch 96 of 256
Processing batch 97 of 256
Processing batch 98 of 256
Processing batch 99 of 256
Processing batch 100 of 256
Processing batch 101 of 256
Processing batch 102 of 256
Processing batch 103 of 256
Processing batch 104 of 256
Processing batch 105 of 256
Processing batch 106 of 256
Processing batch 107 of 256
Processing batch 108 of 256
Processing batch 109 of 256
Processing batch 110 of 256
Processing batch 111 of 256
Processing batch 112 of 256
Processing batch 113 of 256
Processing batch 114 of 256
Processing batch 115 of 256
Processing batch 116 of 256
Processing batch 117 of 256
Processing batch 118 of 256
Processing batch 119 of 256
Processing batch 120 of 256
Processing batch 121 of 256
Processing batch 122 of 256
Processing batch 123 of 256
Processing batch 124 of 256
Processing batch 125 of 256
Processing batch 126 of 256
Processing batch 127 of 256
Processing batch 128 of 256
Processing batch 129 of 256
Processing batch 130 of 256
Processing batch 131 of 256
Processing batch 132 of 256
Processing batch 133 of 256
Processing batch 134 of 256
Processing batch 135 of 256
Processing batch 136 of 256
Processing batch 137 of 256
Processing batch 138 of 256
Processing batch 139 of 256
Processing batch 140 of 256
Processing batch 141 of 256
Processing batch 142 of 256
Processing batch 143 of 256
Processing batch 144 of 256
Processing batch 145 of 256
Processing batch 146 of 256
Processing batch 147 of 256
Processing batch 148 of 256
Processing batch 149 of 256
Processing batch 150 of 256
Processing batch 151 of 256
Processing batch 152 of 256
Processing batch 153 of 256
Processing batch 154 of 256
Processing batch 155 of 256
Processing batch 156 of 256
Processing batch 157 of 256
Processing batch 158 of 256
Processing batch 159 of 256
Processing batch 160 of 256
Processing batch 161 of 256
Processing batch 162 of 256
Processing batch 163 of 256
Processing batch 164 of 256
Processing batch 165 of 256
Processing batch 166 of 256
Processing batch 167 of 256
Processing batch 168 of 256
Processing batch 169 of 256
Processing batch 170 of 256
Processing batch 171 of 256
Processing batch 172 of 256
Processing batch 173 of 256
Processing batch 174 of 256
Processing batch 175 of 256
Processing batch 176 of 256
Processing batch 177 of 256
Processing batch 178 of 256
Processing batch 179 of 256
Processing batch 180 of 256
Processing batch 181 of 256
Processing batch 182 of 256
Processing batch 183 of 256
Processing batch 184 of 256
Processing batch 185 of 256
Processing batch 186 of 256
Processing batch 187 of 256
Processing batch 188 of 256
Processing batch 189 of 256
Processing batch 190 of 256
Processing batch 191 of 256
Processing batch 192 of 256
Processing batch 193 of 256
Processing batch 194 of 256
Processing batch 195 of 256
Processing batch 196 of 256
Processing batch 197 of 256
Processing batch 198 of 256
Processing batch 199 of 256
Processing batch 200 of 256
Processing batch 201 of 256
Processing batch 202 of 256
Processing batch 203 of 256
Processing batch 204 of 256
Processing batch 205 of 256
Processing batch 206 of 256
Processing batch 207 of 256
Processing batch 208 of 256
Processing batch 209 of 256
Processing batch 210 of 256
Processing batch 211 of 256
Processing batch 212 of 256
Processing batch 213 of 256
Processing batch 214 of 256
Processing batch 215 of 256
Processing batch 216 of 256
Processing batch 217 of 256
Processing batch 218 of 256
Processing batch 219 of 256
Processing batch 220 of 256
Processing batch 221 of 256
Processing batch 222 of 256
Processing batch 223 of 256
Processing batch 224 of 256
Processing batch 225 of 256
Processing batch 226 of 256
Processing batch 227 of 256
Processing batch 228 of 256
Processing batch 229 of 256
Processing batch 230 of 256
Processing batch 231 of 256
Processing batch 232 of 256
Processing batch 233 of 256
Processing batch 234 of 256
Processing batch 235 of 256
Processing batch 236 of 256
Processing batch 237 of 256
Processing batch 238 of 256
Processing batch 239 of 256
Processing batch 240 of 256
Processing batch 241 of 256
Processing batch 242 of 256
Processing batch 243 of 256
Processing batch 244 of 256
Processing batch 245 of 256
Processing batch 246 of 256
Processing batch 247 of 256
Processing batch 248 of 256
Processing batch 249 of 256
Processing batch 250 of 256
Processing batch 251 of 256
Processing batch 252 of 256
Processing batch 253 of 256
Processing batch 254 of 256
Processing batch 255 of 256
Processing batch 256 of 256
Writing csv

Copy the file to your local machine:


In [ ]:
scp s1320903@stonesoup:/disk/scratch/neuroglycerin/submissions/alexnet_based_extra_convlayer.csv.gz /home/aselega/Neuroglycerin/submissions/

And now we are ready to submit it.